sub HTML::Shark::D_Auth::get_cookies {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{select domain, name, value from web_cookie where session_id = ?};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'session_key' });

  my $items;
  while(my @d = $dbi->db_fetch($sth)) {
    my $out_h;
    @$out_h{ 'domain','value','name' } = map {((defined $_)?$_:'')} @d[ 0,2,1];
    push @{$items}, $out_h;
  }
  $dbi->db_done($sth);
  return $items;
}
sub HTML::Shark::D_Auth::get_cookies_by_domain {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{select name, value from web_cookie where session_id = ? and domain = ?};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'session_key','domain' });

  my $items;
  while(my @d = $dbi->db_fetch($sth)) {
    my $out_h;
    @$out_h{ 'value','name' } = map {((defined $_)?$_:'')} @d[ 1,0];
    push @{$items}, $out_h;
  }
  $dbi->db_done($sth);
  return $items;
}
sub HTML::Shark::D_Auth::get_god_flag {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{select count(*) from user_role where userid = ? and role_id = \'god\'};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'userid' });

  my @d = $dbi->db_fetch($sth);
  $dbi->db_done($sth);
  return $d[0];
}
sub HTML::Shark::D_Auth::get_last_login {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{SELECT MAX(event_time)
  FROM web_session_audit
 WHERE userid = ?
   AND event_type = \'LOGIN\';
};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'userid' });

  my @d = $dbi->db_fetch($sth);
  $dbi->db_done($sth);
  return $d[0];
}
sub HTML::Shark::D_Auth::get_session_data {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{select userid, last_time, su_userid, session_ip, expire_cache, no_timeout, god, session_id, entity_id, unix_timestamp(now()) - unix_timestamp(last_time), cis_entity_id, cis_entity_type from web_session where session_id = ?};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'session_key' });

    my $out_h;
    my @d = $dbi->db_fetch($sth);
    $dbi->db_done($sth);
    @$out_h{ 'session_ip','session_key','time_out','userid','last_time','god','cis_entity_id','su_userid','age','cis_entity_type','entity_id','expire_cache' } = map {((defined $_)?$_:'')} @d[ 3,7,5,0,1,6,10,2,9,11,8,4];
    return $out_h;
}
sub HTML::Shark::D_Auth::get_timeout_flag {
  my ($args) = @_;
  return if 0 || $args->{'userid'} eq "";
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{select count(*) from user_role where userid = ? and role_id = \'no_timeout\'};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'userid' });

  my @d = $dbi->db_fetch($sth);
  $dbi->db_done($sth);
  return $d[0];
}
sub HTML::Shark::D_Auth::get_user_by_login {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{select  u.userid, u.password from entity_user u, lk_entity_ccode c where lower(u.ccode) = ? and lower(u.username) = ? and u.ccode = c.ccode and c.login_ok = \'y\'};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'ccode','user' });

  my $items;
  while(my @d = $dbi->db_fetch($sth)) {
    my $out_h;
    @$out_h{ 'passwd','userid' } = map {((defined $_)?$_:'')} @d[ 1,0];
    push @{$items}, $out_h;
  }
  $dbi->db_done($sth);
  return $items;
}
sub HTML::Shark::D_Auth::get_user_by_login_no_ccode {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{select  u.userid, u.password from entity_user u, lk_entity_ccode c where lower(u.username) = ? and u.ccode = c.ccode and c.login_ok = \'y\'};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'user' });

  my $items;
  while(my @d = $dbi->db_fetch($sth)) {
    my $out_h;
    @$out_h{ 'passwd','userid' } = map {((defined $_)?$_:'')} @d[ 1,0];
    push @{$items}, $out_h;
  }
  $dbi->db_done($sth);
  return $items;
}
sub HTML::Shark::D_Auth::remove_cookie {
  my ($args) = @_;
  return if 0 || $args->{'session_key'} eq "" || $args->{'domain'} eq "" || $args->{'name'} eq "";
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{DELETE
    FROM web_cookie
   WHERE session_id = ?
     AND domain     = ?
     AND name       = ?};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'session_key','domain','name' });

  $dbi->db_done($sth);
}
sub HTML::Shark::D_Auth::request_audit_clear {
  my $dbi = LsL::DB::sdbi();
  my $sth;

  $sth = $dbi->db_sql('DELETE FROM web_request_audit');

  $dbi->db_done($sth);
}
sub HTML::Shark::D_Auth::request_audit_insert {
  my ($args) = @_;
  return if 0 || $args->{'userid'} eq "" || $args->{'event_type'} eq "";
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{INSERT INTO common.web_request_audit (userid, event_time, event_type, session_ip, event_request, event_data, event_path) VALUES (?, now(), ?, ?, ?, ?, ?)};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'userid','event_type','session_ip','event_path','event_request','event_data' });

  $dbi->db_done($sth);
}
sub HTML::Shark::D_Auth::session_audit_insert {
  my ($args) = @_;
  return if 0 || $args->{'event_type'} eq "";
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{insert into web_session_audit (userid, event_time, event_type, session_ip, modify_userid) values (?,now(),?,?,?)};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'userid','event_type','session_ip','modify_userid' });

  $dbi->db_done($sth);
}
sub HTML::Shark::D_Auth::session_cis_entity {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{UPDATE web_session SET cis_entity_id  = ?, cis_entity_type = ? WHERE session_id = ?
};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'entity_id','session_id' });

  $dbi->db_done($sth);
}
sub HTML::Shark::D_Auth::session_clean {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{call session_clean(?)};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'userid' });

  $dbi->db_done($sth);
}
sub HTML::Shark::D_Auth::session_delete {
  my ($args) = @_;
  return if 0 || $args->{'session_id'} eq "";
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{call session_delete(?)};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'session_id' });

  $dbi->db_done($sth);
}
sub HTML::Shark::D_Auth::session_entity {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{UPDATE web_session SET entity_id  = ? WHERE session_id = ?
};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'entity_id','session_id' });

  $dbi->db_done($sth);
}
sub HTML::Shark::D_Auth::session_insert {
  my ($args) = @_;
  return if 0 || $args->{'session_id'} eq "" || $args->{'userid'} eq "";
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{insert into web_session (session_id, userid, last_time, no_timeout, god) values (?,?,now(),?,?)};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'session_id','userid','time_out','god' });

  $dbi->db_done($sth);
}
sub HTML::Shark::D_Auth::session_prune {
  my ($args) = @_;
  return if 0 || $args->{'userid'} eq "" || $args->{'age'} eq "";
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{call session_prune(?,?)};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'userid','age' });

  $dbi->db_done($sth);
}
sub HTML::Shark::D_Auth::session_update {
  my ($args) = @_;
  return if 0 || $args->{'userid'} eq "" || $args->{'session_ip'} eq "";
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{update web_session set userid = ?, last_time  = now(), su_userid  = ?, session_ip = ? where session_id = ?};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'userid','su_userid','session_ip','session_id' });

  $dbi->db_done($sth);
}
sub HTML::Shark::D_Auth::set_cookie_small {
  my ($args) = @_;
  return if 0 || $args->{'session_key'} eq "" || $args->{'domain'} eq "" || $args->{'name'} eq "";
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{call set_cookie(?,?,?,?)};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'session_key','domain','name','value' });

  $dbi->db_done($sth);
}
sub HTML::Shark::D_CCode::ccode_active {
  my $dbi = LsL::DB::sdbi();
  my $sth;

  $sth = $dbi->db_sql('select ccode, name, login_ok, active from lk_entity_ccode where active = \'y\' order by ccode');

  my $items;
  while(my @d = $dbi->db_fetch($sth)) {
    my $out_h;
    @$out_h{ 'ccode','login_ok','name','active' } = map {((defined $_)?$_:'')} @d[ 0,2,1,3];
    push @{$items}, $out_h;
  }
  $dbi->db_done($sth);
  return $items;
}
sub HTML::Shark::D_CCode::ccode_all {
  my $dbi = LsL::DB::sdbi();
  my $sth;

  $sth = $dbi->db_sql('select ccode, name, login_ok, active from lk_entity_ccode order by ccode');

  my $items;
  while(my @d = $dbi->db_fetch($sth)) {
    my $out_h;
    @$out_h{ 'ccode','login_ok','name','active' } = map {((defined $_)?$_:'')} @d[ 0,2,1,3];
    push @{$items}, $out_h;
  }
  $dbi->db_done($sth);
  return $items;
}
sub HTML::Shark::D_CCode::ccode_delete {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{DELETE FROM lk_entity_ccode WHERE ccode = ?};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'ccode' });

  $dbi->db_done($sth);
}
sub HTML::Shark::D_CCode::ccode_insert {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{INSERT INTO lk_entity_ccode (ccode, name, login_ok, active) VALUES (?, ?, ?, ?)
};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'ccode','name','login_ok','active' });

  $dbi->db_done($sth);
}
sub HTML::Shark::D_CCode::ccode_list {
  my $dbi = LsL::DB::sdbi();
  my $sth;

  $sth = $dbi->db_sql('select C.ccode, C.name, C.login_ok, C.active, A.user_count, I.user_count from lk_entity_ccode C left outer join (select ccode, count(*) as user_count from entity_user where password is not NULL group by ccode) as A on C.ccode = A.ccode  left outer join (select ccode, count(*) as user_count from entity_user where password is NULL group by ccode) as I on C.ccode = I.ccode order by C.ccode');

  my $items;
  while(my @d = $dbi->db_fetch($sth)) {
    my $out_h;
    @$out_h{ 'ccode','login_ok','inactive_users','name','active','active_users' } = map {((defined $_)?$_:'')} @d[ 0,2,5,1,3,4];
    push @{$items}, $out_h;
  }
  $dbi->db_done($sth);
  return $items;
}
sub HTML::Shark::D_CCode::ccode_login {
  my $dbi = LsL::DB::sdbi();
  my $sth;

  $sth = $dbi->db_sql('select ccode, name, login_ok, active from lk_entity_ccode where login_ok = \'y\' order by ccode');

  my $items;
  while(my @d = $dbi->db_fetch($sth)) {
    my $out_h;
    @$out_h{ 'ccode','login_ok','name','active' } = map {((defined $_)?$_:'')} @d[ 0,2,1,3];
    push @{$items}, $out_h;
  }
  $dbi->db_done($sth);
  return $items;
}
sub HTML::Shark::D_CCode::ccode_login_ok {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{select login_ok from lk_entity_ccode where ccode = ?};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'ccode' });

  my @d = $dbi->db_fetch($sth);
  $dbi->db_done($sth);
  return $d[0];
}
sub HTML::Shark::D_CCode::ccode_role_delete {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{DELETE FROM ccode_role WHERE ccode = ?};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'ccode' });

  $dbi->db_done($sth);
}
sub HTML::Shark::D_CCode::ccode_role_insert {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{INSERT INTO ccode_role (ccode, role_id) VALUES (?, ?)};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'ccode','role' });

  $dbi->db_done($sth);
}
sub HTML::Shark::D_CCode::ccode_role_select {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{select role_id from ccode_role where ccode = ?};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'ccode' });

  my $items = [];
  while(my @d = $dbi->db_fetch($sth)) {
    push @{$items}, $d[0];
  }
  $dbi->db_done($sth);
  return $items;
}
sub HTML::Shark::D_CCode::ccode_select {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{select ccode, name, login_ok, active from lk_entity_ccode where ccode = ?};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'ccode' });

    my $out_h;
    my @d = $dbi->db_fetch($sth);
    $dbi->db_done($sth);
    @$out_h{ 'ccode','login_ok','name','active' } = map {((defined $_)?$_:'')} @d[ 0,2,1,3];
    return $out_h;
}
sub HTML::Shark::D_CCode::ccode_update {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{UPDATE lk_entity_ccode
   SET ccode    = ?,
       name     = ?,
       active   = ?,
       login_ok = ?
 WHERE ccode    = ?};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'ccode','name','login_ok','active','old_ccode' });

  $dbi->db_done($sth);
}
sub HTML::Shark::D_DIO::dio_audit_insert {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{select dio_audit_insert(?,?,?,?)};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'ca_id','ca_cd_id','ca_ip','user' });

  my @d = $dbi->db_fetch($sth);
  $dbi->db_done($sth);
  return $d[0];
}
sub HTML::Shark::D_DIO::dio_delete {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{call dio_delete(?)};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'cd_id' });

  $dbi->db_done($sth);
}
sub HTML::Shark::D_DIO::dio_duplicate {
  my ($args) = @_;
  return if 0 || $args->{'cd_id'} eq "";
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{select dio_duplicate(?)};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'cd_id' });

  my @d = $dbi->db_fetch($sth);
  $dbi->db_done($sth);
  return $d[0];
}
sub HTML::Shark::D_DIO::dio_exp_delete {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{call dio_exp_delete(?,?)};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'cd_id','ce_id' });

  $dbi->db_done($sth);
}
sub HTML::Shark::D_DIO::dio_exp_insert {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{select dio_exp_insert(?,?)};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'cd_id','ce_id' });

  my @d = $dbi->db_fetch($sth);
  $dbi->db_done($sth);
  return $d[0];
}
sub HTML::Shark::D_DIO::dio_expkey_delete {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{call dio_expkey_delete(?,?,?)};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'cd_id','ce_id','ck_key' });

  $dbi->db_done($sth);
}
sub HTML::Shark::D_DIO::dio_expkey_insert {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{call dio_expkey_insert(?,?,?)};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'cd_id','ce_id','ck_key' });

  $dbi->db_done($sth);
}
sub HTML::Shark::D_DIO::dio_inkey_delete {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{delete from core_dio_inkey where ci_cd_id = ? and ci_name = ?};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'cd_id','ci_name' });

  $dbi->db_done($sth);
}
sub HTML::Shark::D_DIO::dio_inkey_insert {
  my ($args) = @_;
  return if 0 || $args->{'cd_id'} eq "" || $args->{'ci_name'} eq "" || $args->{'ci_pos'} eq "";
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{insert into core_dio_inkey (ci_cd_id, ci_name, ci_pos, ci_req, ci_default, ci_key, ci_inout, ci_opt) values (?, ?, ?, ?, ?, ?, ?, ?)};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'cd_id','ci_name','ci_pos','ci_req','ci_default','ci_key','ci_inout','ci_opt' });

  $dbi->db_done($sth);
}
sub HTML::Shark::D_DIO::dio_inkey_update {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{update core_dio_inkey set ci_name = ?, ci_pos = ?, ci_req = ?, ci_default = ?, ci_key = ?, ci_inout = ?, ci_opt = ?  where ci_cd_id = ?  and ci_name = ?};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'ci_name','ci_pos','ci_req','ci_default','ci_key','ci_inout','ci_opt','cd_id','old_name' });

  $dbi->db_done($sth);
}
sub HTML::Shark::D_DIO::dio_insert {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{select dio_insert(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'cd_id','cd_namespace','cd_name','cd_version','cd_sysclass','cd_type','cd_return','cd_profile','cd_cache','cd_cache_expire','cd_stmt','cd_stmt_noarg','cd_repl','cd_action','cd_audit' });

  my @d = $dbi->db_fetch($sth);
  $dbi->db_done($sth);
  return $d[0];
}
sub HTML::Shark::D_DIO::dio_outkey_delete {
  my ($args) = @_;
  return if 0 || $args->{'cd_id'} eq "" || $args->{'co_name'} eq "";
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{delete from core_dio_outkey where co_cd_id = ?  and co_name = ?};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'cd_id','co_name' });

  $dbi->db_done($sth);
}
sub HTML::Shark::D_DIO::dio_outkey_insert {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{insert into core_dio_outkey (co_cd_id,co_name,co_pos,co_default,co_key,co_inout) values (?,?,?,?,?,?)};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'cd_id','co_name','co_pos','co_default','co_key','co_inout' });

  $dbi->db_done($sth);
}
sub HTML::Shark::D_DIO::dio_outkey_update {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{update core_dio_outkey set co_name = ?, co_pos = ?, co_default = ?, co_key = ?, co_inout = ?  where co_cd_id = ?  and co_name = ?};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'co_name','co_pos','co_default','co_key','co_inout','cd_id','old_name' });

  $dbi->db_done($sth);
}
sub HTML::Shark::D_DIO::dio_update {
  my ($args) = @_;
  return if 0 || $args->{'cd_id'} eq "";
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{update core_dio set cd_namespace = ?, cd_name = ?, cd_version = ?, cd_sysclass = ?, cd_type = ?, cd_return = ?, cd_profile = ?, cd_cache = ?, cd_cache_expire = ?, cd_stmt = ?, cd_stmt_noarg = ?, cd_repl = ?, cd_action = ?, cd_audit = ?  where cd_id = ?};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'cd_namespace','cd_name','cd_version','cd_sysclass','cd_type','cd_return','cd_profile','cd_cache','cd_cache_expire','cd_stmt','cd_stmt_noarg','cd_repl','cd_action','cd_audit','cd_id' });

  $dbi->db_done($sth);
}
sub HTML::Shark::D_DIO::get_dio {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{select  cd_id,cd_namespace,cd_name,cd_version,cd_sysclass,cd_type,cd_cache,cd_return,cd_stmt,cd_stmt_noarg,cd_cache_expire,cd_profile,cd_repl,cd_action,cd_audit from core_dio where cd_id = ?};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'cd_id' });

    my $out_h;
    my @d = $dbi->db_fetch($sth);
    $dbi->db_done($sth);
    @$out_h{ 'cd_cache_expire','cd_audit','cd_id','cd_sysclass','cd_return','cd_profile','cd_version','cd_stmt','cd_stmt_noarg','cd_repl','cd_action','cd_cache','cd_type','cd_name','cd_namespace' } = map {((defined $_)?$_:'')} @d[ 10,14,0,4,7,11,3,8,9,12,13,6,5,2,1];
    return $out_h;
}
sub HTML::Shark::D_DIO::get_dio_exp_keys {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{select ck_key from core_dio_cache_exp_key where ck_cd_id = ? and ck_exp_id = ? order by ck_key};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'cd_id','ce_id' });

  my $items = [];
  while(my @d = $dbi->db_fetch($sth)) {
    push @{$items}, [@d];
  }
  $dbi->db_done($sth);
  return $items;
}
sub HTML::Shark::D_DIO::get_dio_exps {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{select ce_exp_id, cd_name from core_dio, core_dio_cache_exp where ce_cd_id = ? and cd_id = ce_exp_id order by cd_name};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'cd_id' });

  my $items;
  while(my @d = $dbi->db_fetch($sth)) {
    my $out_h;
    @$out_h{ 'cd_id','ce_name' } = map {((defined $_)?$_:'')} @d[ 0,1];
    push @{$items}, $out_h;
  }
  $dbi->db_done($sth);
  return $items;
}
sub HTML::Shark::D_DIO::get_dio_inkey {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{select ci_name,ci_pos,ci_req,ci_default, ci_key, ci_inout, ci_opt from core_dio_inkey where ci_cd_id = ? and ci_name = ?};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'cd_id','ci_name' });

    my $out_h;
    my @d = $dbi->db_fetch($sth);
    $dbi->db_done($sth);
    @$out_h{ 'ci_req','ci_pos','ci_default','ci_key','ci_inout','ci_name','ci_opt' } = map {((defined $_)?$_:'')} @d[ 2,1,3,4,5,0,6];
    return $out_h;
}
sub HTML::Shark::D_DIO::get_dio_inkeys {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{select ci_name, ci_pos, ci_req, ci_default, ci_key, ci_inout, ci_opt from core_dio_inkey where ci_cd_id = ? order by ci_pos};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'cd_id' });

  my $items;
  while(my @d = $dbi->db_fetch($sth)) {
    my $out_h;
    @$out_h{ 'ci_req','ci_pos','ci_default','ci_key','ci_inout','ci_name','ci_opt' } = map {((defined $_)?$_:'')} @d[ 2,1,3,4,5,0,6];
    push @{$items}, $out_h;
  }
  $dbi->db_done($sth);
  return $items;
}
sub HTML::Shark::D_DIO::get_dio_outkey {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{select co_name,co_pos,co_default,co_key,co_inout from core_dio_outkey where co_cd_id = ? and co_name = ?};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'cd_id','co_name' });

    my $out_h;
    my @d = $dbi->db_fetch($sth);
    $dbi->db_done($sth);
    @$out_h{ 'co_name','co_inout','co_key','co_default','co_pos' } = map {((defined $_)?$_:'')} @d[ 0,4,3,2,1];
    return $out_h;
}
sub HTML::Shark::D_DIO::get_dio_outkeys {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{select co_name,co_pos,co_default,co_key,co_inout from core_dio_outkey where co_cd_id = ? order by co_pos};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'cd_id' });

  my $items;
  while(my @d = $dbi->db_fetch($sth)) {
    my $out_h;
    @$out_h{ 'co_name','co_inout','co_key','co_default','co_pos' } = map {((defined $_)?$_:'')} @d[ 0,4,3,2,1];
    push @{$items}, $out_h;
  }
  $dbi->db_done($sth);
  return $items;
}
sub HTML::Shark::D_DIO::get_namespaces {
  my $dbi = LsL::DB::sdbi();
  my $sth;

  $sth = $dbi->db_sql('select distinct cd_namespace from core_dio order by cd_namespace');

  my $items = [];
  while(my @d = $dbi->db_fetch($sth)) {
    push @{$items}, [@d];
  }
  $dbi->db_done($sth);
  return $items;
}
sub HTML::Shark::D_DIO::profile_off {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{update core_dio set cd_profile = null where cd_id = ?};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'cd_id' });

  $dbi->db_done($sth);
}
sub HTML::Shark::D_DIO::profile_on {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{update core_dio set cd_profile = \'1\' where cd_id = ?};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'cd_id' });

  $dbi->db_done($sth);
}
sub HTML::Shark::D_Group::get_www_group {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{select WG_MODULE_ID, WG_GROUP_ID, WG_NAME, WG_TITLE, WG_ICON, WG_DESC, WG_PRI, WM_NAME from www_group, www_module where wg_group_id = ? and wg_module_id = wm_module_id order by wm_name, wg_pri};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'group_id' });

    my $out_h;
    my @d = $dbi->db_fetch($sth);
    $dbi->db_done($sth);
    @$out_h{ 'icon','module_id','name','group_id','desc','module_name','title','pri' } = map {((defined $_)?$_:'')} @d[ 4,0,2,1,5,7,3,6];
    return $out_h;
}
sub HTML::Shark::D_Group::get_www_group_client_roles {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{select wr_group_id, wr_role_id from www_group_client_role where wr_group_id = ?};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'group_id' });

  my $items;
  while(my @d = $dbi->db_fetch($sth)) {
    my $out_h;
    @$out_h{ 'group_id','role' } = map {((defined $_)?$_:'')} @d[ 0,1];
    push @{$items}, $out_h;
  }
  $dbi->db_done($sth);
  return $items;
}
sub HTML::Shark::D_Group::get_www_group_roles {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{select wr_group_id, er.name, wr_role_id from www_group_role, lk_entity_role er where wr_group_id = ? and er.role_id = wr_role_id};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'group_id' });

  my $items;
  while(my @d = $dbi->db_fetch($sth)) {
    my $out_h;
    @$out_h{ 'group_id','name','role' } = map {((defined $_)?$_:'')} @d[ 0,1,2];
    push @{$items}, $out_h;
  }
  $dbi->db_done($sth);
  return $items;
}
sub HTML::Shark::D_Group::get_www_group_scripts {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{select g.ws_group_id, g.ws_script_id, s.ws_path, s.ws_title from www_group_script g, www_script s where g.ws_group_id = ? and g.ws_script_id = s.ws_script_id order by s.ws_pri};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'group_id' });

  my $items;
  while(my @d = $dbi->db_fetch($sth)) {
    my $out_h;
    @$out_h{ 'group_id','path','title','script_id' } = map {((defined $_)?$_:'')} @d[ 0,2,3,1];
    push @{$items}, $out_h;
  }
  $dbi->db_done($sth);
  return $items;
}
sub HTML::Shark::D_Group::get_www_groups {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{select WG_MODULE_ID, WG_GROUP_ID, WG_NAME, WG_TITLE, WG_ICON, WG_DESC, WG_PRI, WM_NAME from www_group, www_module where wg_module_id = ? and wg_module_id = wm_module_id order by wm_name, wg_pri};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'module_id' });

  my $items;
  while(my @d = $dbi->db_fetch($sth)) {
    my $out_h;
    @$out_h{ 'icon','module_id','name','group_id','desc','module_name','title','pri' } = map {((defined $_)?$_:'')} @d[ 4,0,2,1,5,7,3,6];
    push @{$items}, $out_h;
  }
  $dbi->db_done($sth);
  return $items;
}
sub HTML::Shark::D_Group::get_www_groups_all {
  my $dbi = LsL::DB::sdbi();
  my $sth;

  $sth = $dbi->db_sql('select WG_MODULE_ID, WG_GROUP_ID, WG_NAME, WG_TITLE, WG_ICON, WG_DESC, WG_PRI, WM_NAME from www_group, www_module where wg_module_id = wm_module_id order by wm_name, wg_pri');

  my $items;
  while(my @d = $dbi->db_fetch($sth)) {
    my $out_h;
    @$out_h{ 'icon','module_id','name','group_id','desc','module_name','title','pri' } = map {((defined $_)?$_:'')} @d[ 4,0,2,1,5,7,3,6];
    push @{$items}, $out_h;
  }
  $dbi->db_done($sth);
  return $items;
}
sub HTML::Shark::D_Group::get_www_module {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{select WM_MODULE_ID, WM_NAME, WM_TITLE, WM_ICON, WM_MENU, WM_PRI, WM_BASE, WM_TAB from www_module where wm_module_id = ?};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'module_id' });

    my $out_h;
    my @d = $dbi->db_fetch($sth);
    $dbi->db_done($sth);
    @$out_h{ 'icon','base','module_id','name','menu','tab','pri','title' } = map {((defined $_)?$_:'')} @d[ 3,6,0,1,4,7,5,2];
    return $out_h;
}
sub HTML::Shark::D_Group::get_www_module_client_roles {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{select wr_module_id, wr_role_id from www_module_client_role where wr_module_id = ?};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'module_id' });

  my $items;
  while(my @d = $dbi->db_fetch($sth)) {
    my $out_h;
    @$out_h{ 'module_id','role' } = map {((defined $_)?$_:'')} @d[ 0,1];
    push @{$items}, $out_h;
  }
  $dbi->db_done($sth);
  return $items;
}
sub HTML::Shark::D_Group::get_www_module_roles {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{select wr_module_id, wr_role_id, er.name from www_module_role, lk_entity_role er where wr_module_id = ? and wr_role_id = er.role_id};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'module_id' });

  my $items;
  while(my @d = $dbi->db_fetch($sth)) {
    my $out_h;
    @$out_h{ 'module_id','name','role' } = map {((defined $_)?$_:'')} @d[ 0,2,1];
    push @{$items}, $out_h;
  }
  $dbi->db_done($sth);
  return $items;
}
sub HTML::Shark::D_Group::get_www_modules {
  my $dbi = LsL::DB::sdbi();
  my $sth;

  $sth = $dbi->db_sql('select WM_MODULE_ID, WM_NAME, WM_TITLE, WM_ICON, WM_MENU, WM_PRI, WM_BASE, WM_TAB from www_module order by wm_pri');

  my $items;
  while(my @d = $dbi->db_fetch($sth)) {
    my $out_h;
    @$out_h{ 'icon','base','module_id','name','menu','tab','pri','title' } = map {((defined $_)?$_:'')} @d[ 3,6,0,1,4,7,5,2];
    push @{$items}, $out_h;
  }
  $dbi->db_done($sth);
  return $items;
}
sub HTML::Shark::D_Group::get_www_script {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{select WS_SCRIPT_ID, WS_PATH, WS_TITLE, WS_ICON, WS_DESC, WS_PRI, WS_HANDLER from www_script where ws_script_id = ?};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'script_id' });

    my $out_h;
    my @d = $dbi->db_fetch($sth);
    $dbi->db_done($sth);
    @$out_h{ 'icon','handler','desc','path','title','pri','script_id' } = map {((defined $_)?$_:'')} @d[ 3,6,4,1,2,5,0];
    return $out_h;
}
sub HTML::Shark::D_Group::get_www_script_client_roles {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{select wr_script_id, wr_role_id from www_script_client_role where wr_script_id = ?};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'script_id' });

  my $items;
  while(my @d = $dbi->db_fetch($sth)) {
    my $out_h;
    @$out_h{ 'script_id','role' } = map {((defined $_)?$_:'')} @d[ 0,1];
    push @{$items}, $out_h;
  }
  $dbi->db_done($sth);
  return $items;
}
sub HTML::Shark::D_Group::get_www_script_roles {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{select er.name, wr_script_id, wr_role_id from www_script_role, lk_entity_role er where wr_script_id = ? and wr_role_id = er.role_id};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'script_id' });

  my $items;
  while(my @d = $dbi->db_fetch($sth)) {
    my $out_h;
    @$out_h{ 'name','script_id','role' } = map {((defined $_)?$_:'')} @d[ 0,1,2];
    push @{$items}, $out_h;
  }
  $dbi->db_done($sth);
  return $items;
}
sub HTML::Shark::D_Group::get_www_scripts {
  my $dbi = LsL::DB::sdbi();
  my $sth;

  $sth = $dbi->db_sql('select WS_SCRIPT_ID, WS_PATH, WS_TITLE, WS_ICON, WS_DESC, WS_PRI, WS_HANDLER from www_script order by ws_path');

  my $items;
  while(my @d = $dbi->db_fetch($sth)) {
    my $out_h;
    @$out_h{ 'icon','handler','desc','path','title','pri','script_id' } = map {((defined $_)?$_:'')} @d[ 3,6,4,1,2,5,0];
    push @{$items}, $out_h;
  }
  $dbi->db_done($sth);
  return $items;
}
sub HTML::Shark::D_Group::www_group_delete {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{call group_delete(?)};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'group_id' });

  $dbi->db_done($sth);
}
sub HTML::Shark::D_Group::www_group_delete_client_roles {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{call group_delete_client_roles(?)};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'group_id' });

  $dbi->db_done($sth);
}
sub HTML::Shark::D_Group::www_group_delete_roles {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{call group_delete_roles(?)};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'group_id' });

  $dbi->db_done($sth);
}
sub HTML::Shark::D_Group::www_group_delete_scripts {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{call group_delete_scripts(?)};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'group_id' });

  $dbi->db_done($sth);
}
sub HTML::Shark::D_Group::www_group_insert {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{select group_insert(?,?,?,?,?,?,?)};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'name','title','icon','desc','pri','module_id','group_id' });

  my @d = $dbi->db_fetch($sth);
  $dbi->db_done($sth);
  return $d[0];
}
sub HTML::Shark::D_Group::www_group_insert_client_role {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{insert into www_group_client_role (wr_group_id, wr_role_id) values (?, ?)
};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'group_id','role' });

  $dbi->db_done($sth);
}
sub HTML::Shark::D_Group::www_group_insert_role {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{insert into www_group_role (wr_group_id, wr_role_id) values (?, ?)
};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'group_id','role' });

  $dbi->db_done($sth);
}
sub HTML::Shark::D_Group::www_group_insert_script {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{insert into www_group_script (ws_group_id, ws_script_id) values (?, ?)
};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'group_id','script_id' });

  $dbi->db_done($sth);
}
sub HTML::Shark::D_Group::www_group_update {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{update www_group
   set WG_NAME       = ?,
       WG_TITLE      = ?,
       WG_ICON       = ?,
       WG_DESC       = ?,
       WG_PRI        = ?,
       WG_MODULE_ID  = ?
 where WG_GROUP_ID   = ?};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'name','title','icon','desc','pri','module_id','group_id' });

  $dbi->db_done($sth);
}
sub HTML::Shark::D_Group::www_module_delete_client_roles {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{call module_delete_client_roles(?)};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'module_id' });

  $dbi->db_done($sth);
}
sub HTML::Shark::D_Group::www_module_delete_roles {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{call module_delete_roles(?)};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'module_id' });

  $dbi->db_done($sth);
}
sub HTML::Shark::D_Group::www_module_insert {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{select module_insert(?,?,?,?,?,?,?,?)};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'name','title','icon','menu','pri','base','tab','module_id' });

  my @d = $dbi->db_fetch($sth);
  $dbi->db_done($sth);
  return $d[0];
}
sub HTML::Shark::D_Group::www_module_insert_client_role {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{insert into www_module_client_role (wr_module_id, wr_role_id) values (?, ?)
};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'role' });

  $dbi->db_done($sth);
}
sub HTML::Shark::D_Group::www_module_insert_role {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{insert into www_module_role (wr_module_id, wr_role_id) values (?, ?)
};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'module_id','role' });

  $dbi->db_done($sth);
}
sub HTML::Shark::D_Group::www_module_update {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{  update www_module
     set WM_NAME  = ?,
         WM_TITLE = ?,
         WM_ICON  = ?,
         WM_MENU  = ?,
         WM_PRI   = ?,
         WM_BASE  = ?,
         WM_TAB   = ?
   where WM_MODULE_ID = ?};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'name','title','icon','menu','pri','base','tab','module_id' });

  $dbi->db_done($sth);
}
sub HTML::Shark::D_Group::www_script_delete {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{call script_delete(?)};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'script_id' });

  $dbi->db_done($sth);
}
sub HTML::Shark::D_Group::www_script_delete_client_roles {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{call script_delete_client_roles(?)};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'script_id' });

  $dbi->db_done($sth);
}
sub HTML::Shark::D_Group::www_script_delete_roles {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{call script_delete_roles(?)};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'script_id' });

  $dbi->db_done($sth);
}
sub HTML::Shark::D_Group::www_script_in_use {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{select script_in_use(?)};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'script_id' });

  my @d = $dbi->db_fetch($sth);
  $dbi->db_done($sth);
  return $d[0];
}
sub HTML::Shark::D_Group::www_script_insert {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{select script_insert(?,?,?,?,?,?,?)};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'path','title','icon','desc','handler','pri','script_id' });

  my @d = $dbi->db_fetch($sth);
  $dbi->db_done($sth);
  return $d[0];
}
sub HTML::Shark::D_Group::www_script_insert_client_role {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{insert into www_script_client_role (wr_script_id, wr_role_id) values (?, ?)
};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'script_id','role' });

  $dbi->db_done($sth);
}
sub HTML::Shark::D_Group::www_script_insert_role {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{insert into www_script_role (wr_script_id, wr_role_id) values (?, ?)};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'script_id','role' });

  $dbi->db_done($sth);
}
sub HTML::Shark::D_Group::www_script_update {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{update www_script
   set WS_PATH      = ?,
       WS_TITLE     = ?,
       WS_ICON      = ?,
       WS_DESC      = ?,   
       WS_HANDLER   = ?,
       WS_PRI       = ?
 where WS_SCRIPT_ID = ?
};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'path','title','icon','desc','handler','pri','script_id' });

  $dbi->db_done($sth);
}
sub HTML::Shark::D_Profile::delete_user_roles {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{DELETE FROM user_role where userid = ?};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'userid' });

  $dbi->db_done($sth);
}
sub HTML::Shark::D_Profile::reset_user_password {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{UPDATE entity_user SET set_password = null WHERE userid = ?;
};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'userid' });

  $dbi->db_done($sth);
}
sub HTML::Shark::D_Profile::set_user_password {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{UPDATE entity_user SET password  = ? WHERE entity_id = ?};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'userid','password' });

  $dbi->db_done($sth);
}
sub HTML::Shark::D_Profile::user_profile_check {
  my ($args) = @_;
  return if 0 || $args->{'ccode'} eq "";
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{select count(*) from entity_user where lower(ccode) = lower(?) and lower(username) = lower(?)};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'ccode','username' });

  my @d = $dbi->db_fetch($sth);
  $dbi->db_done($sth);
  return $d[0];
}
sub HTML::Shark::D_Profile::user_profile_insert {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{select user_insert(?,?,?,?,?,?,?,?,?,?,?,?)};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'ccode','lname','fname','mname','nickname','gender','username','password','type','phone','email','userid' });

  my @d = $dbi->db_fetch($sth);
  $dbi->db_done($sth);
  return $d[0];
}
sub HTML::Shark::D_Profile::user_profile_select {
  my ($args) = @_;
  return if 0 || $args->{'userid'} eq "";
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{select userid, ccode, lname, fname, username, email, set_password, type, phone, remember_login, whats_new, password from entity_user where userid = ?};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'userid' });

    my $out_h;
    my @d = $dbi->db_fetch($sth);
    $dbi->db_done($sth);
    @$out_h{ 'ccode','userid','fname','set_password','phone','username','email','password','lname','whats_new','type','remember_login' } = map {((defined $_)?$_:'')} @d[ 1,0,3,6,8,4,5,11,2,10,7,9];
    return $out_h;
}
sub HTML::Shark::D_Profile::user_profile_update {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{UPDATE entity_user
     set ccode       = ?,
         lname       = ?,
         fname       = ?,
         mname       = ?,
         nickname    = ?,
         gender      = ?,
         username    = ?,
         type   = ?,
         phone        = ?,
         email        = ?
   where userid   = ?};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'ccode','lname','fname','mname','nickname','gender','username','type','phone','email','userid' });

  $dbi->db_done($sth);
}
sub HTML::Shark::D_Profile::user_role_insert {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{INSERT INTO user_role (userid, role_id) VALUES (?, ?)};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'userid','role' });

  $dbi->db_done($sth);
}
sub HTML::Shark::D_Profile::user_roles_select {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{select role_id from user_role where userid = ?};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'userid' });

  my $items = [];
  while(my @d = $dbi->db_fetch($sth)) {
    push @{$items}, $d[0];
  }
  $dbi->db_done($sth);
  return $items;
}
sub HTML::Shark::D_Role::role_delete {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{DELETE FROM lk_entity_role WHERE role_id = ?};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'role_id' });

  $dbi->db_done($sth);
}
sub HTML::Shark::D_Role::role_insert {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{INSERT INTO lk_entity_role
    (role_id, name, description, category, `restrict`)
  VALUES
    (?, ?, ?, ?, ?)
};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'role_id','name','description','category','restrict' });

  $dbi->db_done($sth);
}
sub HTML::Shark::D_Role::role_list {
  my $dbi = LsL::DB::sdbi();
  my $sth;

  $sth = $dbi->db_sql('select role_id, name, description, category, `restrict` from lk_entity_role order by category, name');

  my $items;
  while(my @d = $dbi->db_fetch($sth)) {
    my $out_h;
    @$out_h{ 'name','category','description','restrict','role_id' } = map {((defined $_)?$_:'')} @d[ 1,3,2,4,0];
    push @{$items}, $out_h;
  }
  $dbi->db_done($sth);
  return $items;
}
sub HTML::Shark::D_Role::role_select {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{select role_id, name, description, category, `restrict` from lk_entity_role where role_id = ?};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'role_id' });

    my $out_h;
    my @d = $dbi->db_fetch($sth);
    $dbi->db_done($sth);
    @$out_h{ 'name','category','description','restrict','role_id' } = map {((defined $_)?$_:'')} @d[ 1,3,2,4,0];
    return $out_h;
}
sub HTML::Shark::D_Role::role_tmpl_add {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{call role_tmpl_add(?,?)};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'role_id','template' });

  $dbi->db_done($sth);
}
sub HTML::Shark::D_Role::role_tmpl_delete {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{DELETE FROM lk_entity_role_tmpl WHERE role_id = ? AND template = ?
};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'role_id','template' });

  $dbi->db_done($sth);
}
sub HTML::Shark::D_Role::role_tmpl_list {
  my $dbi = LsL::DB::sdbi();
  my $sth;

  $sth = $dbi->db_sql('select r.role_id, r.name, r.description, r.category, r.restrict, t.template from lk_entity_role r, lk_entity_role_tmpl t where r.role_id = t.role_id and t.role_id = ? and t.template = ?');

  my $items;
  while(my @d = $dbi->db_fetch($sth)) {
    my $out_h;
    @$out_h{ 'template','name','category','description','restrict','role_id' } = map {((defined $_)?$_:'')} @d[ 5,1,3,2,4,0];
    push @{$items}, $out_h;
  }
  $dbi->db_done($sth);
  return $items;
}
sub HTML::Shark::D_Role::role_tmpl_select {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{select r.role_id, r.name, r.description, r.category, r.restrict, t.template from lk_entity_role r, lk_entity_role_tmpl t where r.role_id = t.role_id and t.role_id = ? and t.template = ?};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'role_id','template' });

    my $out_h;
    my @d = $dbi->db_fetch($sth);
    $dbi->db_done($sth);
    @$out_h{ 'template','name','category','description','restrict','role_id' } = map {((defined $_)?$_:'')} @d[ 5,1,3,2,4,0];
    return $out_h;
}
sub HTML::Shark::D_Role::role_update {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{UPDATE lk_entity_role
   SET role_id     = ?,
       name        = ?,
       description = ?,
       category    = ?,
       `restrict`  = ?
 WHERE role_id     = ?
};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'role_id','name','description','category','restrict','old_role_id' });

  $dbi->db_done($sth);
}
sub HTML::Shark::D_User::get_ccode_userids {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{select userid from entity_user where ccode = ?};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'ccode' });

  my $items = [];
  while(my @d = $dbi->db_fetch($sth)) {
    push @{$items}, $d[0];
  }
  $dbi->db_done($sth);
  return $items;
}
sub HTML::Shark::D_User::get_ccodes {
  my $dbi = LsL::DB::sdbi();
  my $sth;

  $sth = $dbi->db_sql('select ccode, name, login_ok from lk_entity_ccode order by ccode');

  my $items;
  while(my @d = $dbi->db_fetch($sth)) {
    my $out_h;
    @$out_h{ 'ccode','login_ok','name' } = map {((defined $_)?$_:'')} @d[ 0,2,1];
    push @{$items}, $out_h;
  }
  $dbi->db_done($sth);
  return $items;
}
sub HTML::Shark::D_User::get_ccodes_in_use {
  my $dbi = LsL::DB::sdbi();
  my $sth;

  $sth = $dbi->db_sql('select distinct ccode from entity_user order by ccode');

  my $items = [];
  while(my @d = $dbi->db_fetch($sth)) {
    push @{$items}, $d[0];
  }
  $dbi->db_done($sth);
  return $items;
}
sub HTML::Shark::D_User::get_ccodes_login_ok {
  my $dbi = LsL::DB::sdbi();
  my $sth;

  $sth = $dbi->db_sql('select ccode, name from lk_entity_ccode where login_ok = \'y\' order by ccode');

  my $items;
  while(my @d = $dbi->db_fetch($sth)) {
    my $out_h;
    @$out_h{ 'ccode','name' } = map {((defined $_)?$_:'')} @d[ 0,1];
    push @{$items}, $out_h;
  }
  $dbi->db_done($sth);
  return $items;
}
sub HTML::Shark::D_User::get_logins_by_hour {
  my $dbi = LsL::DB::sdbi();
  my $sth;

  $sth = $dbi->db_sql('select date_format(event_time,\'%h%p\'), ccode, count(*) from web_session_audit a, entity_user u where u.userid = a.userid and date_format(event_time,\'%Y-%m-%d\') = date_format(now(),\'%Y-%m-%d\') and a.event_type = \'LOGIN\' group by date_format(event_time,\'%h%p\'), ccode');

  my $items;
  while(my @d = $dbi->db_fetch($sth)) {
    my $out_h;
    @$out_h{ 'hour','ccode','count' } = map {((defined $_)?$_:'')} @d[ 0,1,2];
    push @{$items}, $out_h;
  }
  $dbi->db_done($sth);
  return $items;
}
sub HTML::Shark::D_User::get_online_sessions {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{select concat(P.fname, \' \', P.lname) as name, P.userid, P.ccode, P.type, S.last_time, S.session_ip ip from entity_user P, web_session S where P.userid = S.userid and (unix_timestamp(now()) - unix_timestamp(S.last_time)) <= ?};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'age' });

  my $items;
  while(my @d = $dbi->db_fetch($sth)) {
    my $out_h;
    @$out_h{ 'ccode','userid','name','type','sessionip','lasttime' } = map {((defined $_)?$_:'')} @d[ 2,1,0,3,5,4];
    push @{$items}, $out_h;
  }
  $dbi->db_done($sth);
  return $items;
}
sub HTML::Shark::D_User::get_online_sessions_ccode {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{select concat(P.fname, \' \', P.lname) as name, P.userid, P.ccode, P.type, S.last_time, S.session_ip ip from entity_user P, web_session S where P.userid = S.userid and (unix_timestamp(now()) - unix_timestamp(S.last_time)) <= ? and p.ccode = ?};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'age','ccode' });

  my $items;
  while(my @d = $dbi->db_fetch($sth)) {
    my $out_h;
    @$out_h{ 'ccode','userid','name','type','sessionip','lasttime' } = map {((defined $_)?$_:'')} @d[ 2,1,0,3,5,4];
    push @{$items}, $out_h;
  }
  $dbi->db_done($sth);
  return $items;
}
sub HTML::Shark::D_User::get_roles {
  my $dbi = LsL::DB::sdbi();
  my $sth;

  $sth = $dbi->db_sql('select role_id, name, description, `restrict` from lk_entity_role order by name');

  my $items;
  while(my @d = $dbi->db_fetch($sth)) {
    my $out_h;
    @$out_h{ 'desc','name','role','restrict' } = map {((defined $_)?$_:'')} @d[ 2,1,0,3];
    push @{$items}, $out_h;
  }
  $dbi->db_done($sth);
  return $items;
}
sub HTML::Shark::D_User::get_types_in_use {
  my $dbi = LsL::DB::sdbi();
  my $sth;

  $sth = $dbi->db_sql('select distinct( type ) from entity_user order by type');

  my $items = [];
  while(my @d = $dbi->db_fetch($sth)) {
    push @{$items}, $d[0];
  }
  $dbi->db_done($sth);
  return $items;
}
sub HTML::Shark::D_User::get_user_in_use {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{select user_in_use(?)};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'userid' });

  my @d = $dbi->db_fetch($sth);
  $dbi->db_done($sth);
  return $d[0];
}
sub HTML::Shark::D_User::get_user_info {
  my ($args) = @_;
  return if 0 || $args->{'userid'} eq "";
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{select userid, ccode, lname, fname, username, email, set_password, type, phone, remember_login, whats_new, password from entity_user where userid = ?};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'userid' });

    my $out_h;
    my @d = $dbi->db_fetch($sth);
    $dbi->db_done($sth);
    @$out_h{ 'ccode','userid','fname','set_password','phone','username','email','password','lname','whats_new','type','remember_login' } = map {((defined $_)?$_:'')} @d[ 1,0,3,6,8,4,5,11,2,10,7,9];
    return $out_h;
}
sub HTML::Shark::D_User::get_user_info_all {
  my ($args) = @_;
  return if 0 || $args->{'userid'} eq "";
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{select userid, ccode, lname, fname, username, email, set_password, type, phone, remember_login, whats_new, password from entity_user where userid = ?};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'userid' });

    my $out_h;
    my @d = $dbi->db_fetch($sth);
    $dbi->db_done($sth);
    @$out_h{ 'ccode','userid','fname','set_password','phone','username','email','password','lname','whats_new','type','remember_login' } = map {((defined $_)?$_:'')} @d[ 1,0,3,6,8,4,5,11,2,10,7,9];
    return $out_h;
}
sub HTML::Shark::D_User::get_user_roles {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{select role_id from user_role where userid = ?};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'userid' });

  my $items;
  while(my @d = $dbi->db_fetch($sth)) {
    my $out_h;
    @$out_h{ 'role_id' } = map {((defined $_)?$_:'')} $d[ 0];
    push @{$items}, $out_h;
  }
  $dbi->db_done($sth);
  return $items;
}
sub HTML::Shark::D_User::get_user_roles_array {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{select role_id from user_role where userid = ?};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'userid' });

  my $items = [];
  while(my @d = $dbi->db_fetch($sth)) {
    push @{$items}, $d[0];
  }
  $dbi->db_done($sth);
  return $items;
}
sub HTML::Shark::D_User::merge_user {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{call merge_user(?,?)};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'userid','merge_id' });

  $dbi->db_done($sth);
}
sub HTML::Shark::D_User::set_user_disabled {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{update entity_user set password = null where userid = ?};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'userid' });

  $dbi->db_done($sth);
}
sub HTML::Shark::D_User::update_password {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{update entity_user set password = ? where userid = ?};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'password','userid' });

  $dbi->db_done($sth);
}
sub HTML::Shark::D_User::update_set_email {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{update entity_user set email = ? where userid = ?};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'value','userid' });

  $dbi->db_done($sth);
}
sub HTML::Shark::D_User::update_set_password {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{update entity_password set set_password = ? where userid = ?};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'userid' });

  $dbi->db_done($sth);
}
sub HTML::Shark::D_User::update_whats_new {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{update entity_user set whats_new = null where userid = ?};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'userid' });

  $dbi->db_done($sth);
}
sub HTML::Shark::D_User::user_insert {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{select user_insert(?,?,?,?,?,?,?,?,?,?,?,?)};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'ccode','lname','fname','mname','nickname','gender','username','password','type','phone','email','userid' });

  my @d = $dbi->db_fetch($sth);
  $dbi->db_done($sth);
  return $d[0];
}
sub HTML::Shark::D_User::user_remove {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{call user_remove(?)};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'userid' });

  $dbi->db_done($sth);
}
sub HTML::Shark::D_User::user_search {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{    select
      userid,
      ccode,
      lname,
      fname, 
      username,
      password,
      set_password,
      type,
      remember_login,
      whats_new
    from
      entity_user
    where
      :ccode :username :type :fname :lname :userid :set_password :active 0 = 0
    order by 
      upper( lname ), upper( fname )
};
  my %tag_hash;
  if (exists $args->{'set_password'} && $args->{'set_password'} ne '') {
    $sql =~ s/:set_password/set_password = ? and/;
    if (ref $args->{'set_password'} eq 'ARRAY') {
      $tag_hash{set_password} = $args->{'set_password'};
    } else {
      $tag_hash{set_password} = [$args->{'set_password'}];
    }
  } else {
    $sql =~ s/:set_password//;
  }
  if (exists $args->{'username'} && $args->{'username'} ne '') {
    $sql =~ s/:username/upper(username) = ? and/;
    if (ref $args->{'username'} eq 'ARRAY') {
      $tag_hash{username} = $args->{'username'};
    } else {
      $tag_hash{username} = [$args->{'username'}];
    }
  } else {
    $sql =~ s/:username//;
  }
  if (exists $args->{'lname'} && $args->{'lname'} ne '') {
    $sql =~ s/:lname/upper(lname) like ? escape and/;
    if (ref $args->{'lname'} eq 'ARRAY') {
      $tag_hash{lname} = $args->{'lname'};
    } else {
      $tag_hash{lname} = [$args->{'lname'}];
    }
  } else {
    $sql =~ s/:lname//;
  }
  if (exists $args->{'ccode'} && $args->{'ccode'} ne '') {
    $sql =~ s/:ccode/upper(ccode) = ? and/;
    if (ref $args->{'ccode'} eq 'ARRAY') {
      $tag_hash{ccode} = $args->{'ccode'};
    } else {
      $tag_hash{ccode} = [$args->{'ccode'}];
    }
  } else {
    $sql =~ s/:ccode//;
  }
  if (exists $args->{'fname'} && $args->{'fname'} ne '') {
    $sql =~ s/:fname/upper(fname) like ? and/;
    if (ref $args->{'fname'} eq 'ARRAY') {
      $tag_hash{fname} = $args->{'fname'};
    } else {
      $tag_hash{fname} = [$args->{'fname'}];
    }
  } else {
    $sql =~ s/:fname//;
  }
  if (exists $args->{'active'} && $args->{'active'} ne '') {
    $sql =~ s/:active/password is not null and/;
  } else {
    $sql =~ s/:active//;
  }
  if (exists $args->{'type'} && $args->{'type'} ne '') {
    $sql =~ s/:type/upper(type) = ? and/;
    if (ref $args->{'type'} eq 'ARRAY') {
      $tag_hash{type} = $args->{'type'};
    } else {
      $tag_hash{type} = [$args->{'type'}];
    }
  } else {
    $sql =~ s/:type//;
  }
  if (exists $args->{'userid'} && $args->{'userid'} ne '') {
    $sql =~ s/:userid/userid = ? and/;
    if (ref $args->{'userid'} eq 'ARRAY') {
      $tag_hash{userid} = $args->{'userid'};
    } else {
      $tag_hash{userid} = [$args->{'userid'}];
    }
  } else {
    $sql =~ s/:userid//;
  }
  $sth = $dbi->db_prep($sql);
  my @binds;
  push @binds, @{$tag_hash{'ccode'}} if exists $tag_hash{'ccode'};
  push @binds, @{$tag_hash{'username'}} if exists $tag_hash{'username'};
  push @binds, @{$tag_hash{'type'}} if exists $tag_hash{'type'};
  push @binds, @{$tag_hash{'fname'}} if exists $tag_hash{'fname'};
  push @binds, @{$tag_hash{'lname'}} if exists $tag_hash{'lname'};
  push @binds, @{$tag_hash{'userid'}} if exists $tag_hash{'userid'};
  push @binds, @{$tag_hash{'set_password'}} if exists $tag_hash{'set_password'};
  if (@binds) {
    $dbi->db_exec($sth, @binds);
  } else {
    $dbi->db_exec($sth);
  }
  my $items;
  while(my @d = $dbi->db_fetch($sth)) {
    my $out_h;
    @$out_h{ 'ccode','userid','fname','set_password','username','password','lname','whats_new','type','remember_login' } = map {((defined $_)?$_:'')} @d[ 1,0,3,6,4,5,2,9,7,8];
    push @{$items}, $out_h;
  }
  $dbi->db_done($sth);
  return $items;
}
sub HTML::Shark::D_User::user_search_count {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{    select
      count(*)
    from
      entity_user
    where
      :ccode :username :type :fname :lname :userid :set_password :active 0 = 0
    order by
      upper( lname ), upper( fname )
};
  my %tag_hash;
  if (exists $args->{'set_password'} && $args->{'set_password'} ne '') {
    $sql =~ s/:set_password/set_password = ? and/;
    if (ref $args->{'set_password'} eq 'ARRAY') {
      $tag_hash{set_password} = $args->{'set_password'};
    } else {
      $tag_hash{set_password} = [$args->{'set_password'}];
    }
  } else {
    $sql =~ s/:set_password//;
  }
  if (exists $args->{'username'} && $args->{'username'} ne '') {
    $sql =~ s/:username/upper(username) = ? and/;
    if (ref $args->{'username'} eq 'ARRAY') {
      $tag_hash{username} = $args->{'username'};
    } else {
      $tag_hash{username} = [$args->{'username'}];
    }
  } else {
    $sql =~ s/:username//;
  }
  if (exists $args->{'lname'} && $args->{'lname'} ne '') {
    $sql =~ s/:lname/upper(lname) like ? escape and/;
    if (ref $args->{'lname'} eq 'ARRAY') {
      $tag_hash{lname} = $args->{'lname'};
    } else {
      $tag_hash{lname} = [$args->{'lname'}];
    }
  } else {
    $sql =~ s/:lname//;
  }
  if (exists $args->{'ccode'} && $args->{'ccode'} ne '') {
    $sql =~ s/:ccode/upper(ccode) = ? and/;
    if (ref $args->{'ccode'} eq 'ARRAY') {
      $tag_hash{ccode} = $args->{'ccode'};
    } else {
      $tag_hash{ccode} = [$args->{'ccode'}];
    }
  } else {
    $sql =~ s/:ccode//;
  }
  if (exists $args->{'fname'} && $args->{'fname'} ne '') {
    $sql =~ s/:fname/upper(fname) like ? and/;
    if (ref $args->{'fname'} eq 'ARRAY') {
      $tag_hash{fname} = $args->{'fname'};
    } else {
      $tag_hash{fname} = [$args->{'fname'}];
    }
  } else {
    $sql =~ s/:fname//;
  }
  if (exists $args->{'active'} && $args->{'active'} ne '') {
    $sql =~ s/:active/password is not null and/;
  } else {
    $sql =~ s/:active//;
  }
  if (exists $args->{'type'} && $args->{'type'} ne '') {
    $sql =~ s/:type/upper(type) = ? and/;
    if (ref $args->{'type'} eq 'ARRAY') {
      $tag_hash{type} = $args->{'type'};
    } else {
      $tag_hash{type} = [$args->{'type'}];
    }
  } else {
    $sql =~ s/:type//;
  }
  if (exists $args->{'userid'} && $args->{'userid'} ne '') {
    $sql =~ s/:userid/userid = ? and/;
    if (ref $args->{'userid'} eq 'ARRAY') {
      $tag_hash{userid} = $args->{'userid'};
    } else {
      $tag_hash{userid} = [$args->{'userid'}];
    }
  } else {
    $sql =~ s/:userid//;
  }
  $sth = $dbi->db_prep($sql);
  my @binds;
  push @binds, @{$tag_hash{'ccode'}} if exists $tag_hash{'ccode'};
  push @binds, @{$tag_hash{'username'}} if exists $tag_hash{'username'};
  push @binds, @{$tag_hash{'type'}} if exists $tag_hash{'type'};
  push @binds, @{$tag_hash{'fname'}} if exists $tag_hash{'fname'};
  push @binds, @{$tag_hash{'lname'}} if exists $tag_hash{'lname'};
  push @binds, @{$tag_hash{'userid'}} if exists $tag_hash{'userid'};
  push @binds, @{$tag_hash{'set_password'}} if exists $tag_hash{'set_password'};
  if (@binds) {
    $dbi->db_exec($sth, @binds);
  } else {
    $dbi->db_exec($sth);
  }
  my @d = $dbi->db_fetch($sth);
  $dbi->db_done($sth);
  return $d[0];
}
sub HTML::Shark::D_User::user_update {
  my ($args) = @_;
  return if 0;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  my $sql = q{UPDATE entity_user
     set ccode       = ?,
         lname       = ?,
         fname       = ?,
         mname       = ?,
         nickname    = ?,
         gender      = ?,
         username    = ?,
         type   = ?,
         phone        = ?,
         email        = ?
   where userid   = ?};
  $sth = $dbi->db_prep($sql);
  $dbi->db_exec($sth, @$args{ 'ccode','lname','fname','mname','nickname','gender','username','type','phone','email','userid' });

  $dbi->db_done($sth);
}
sub HTML::Shark::D_Util::current_date {
  my $dbi = LsL::DB::sdbi();
  my $sth;

  $sth = $dbi->db_sql('select date_format(now(),\'%m\'), date_format(now(),\'%d\'), date_format(now(),\'%Y\')');

    my @d = $dbi->db_fetch($sth);
    $dbi->db_done($sth);
    return \@d;
}
sub HTML::Shark::D_Util::current_time {
  my $dbi = LsL::DB::sdbi();
  my $sth;

  $sth = $dbi->db_sql('SELECT DATE_FORMAT(CONVERT_TZ(NOW(),?,\'PST\'),\'%h:%i:%p\')');

  my @d = $dbi->db_fetch($sth);
  $dbi->db_done($sth);
  return $d[0];
}
sub HTML::Shark::D_Util::current_unixtime {
  my $dbi = LsL::DB::sdbi();
  my $sth;

  $sth = $dbi->db_sql('select unix_timestamp(now())');

  my @d = $dbi->db_fetch($sth);
  $dbi->db_done($sth);
  return $d[0];
}
package HTML::Shark::D_DIO::dio_list;
sub new {
  my ($class) = @_;
  my $dbi = LsL::DB::sdbi();
  my $sth;

  $sth = $dbi->db_sql('select cd_id, cd_namespace, cd_name, cd_version, cd_sysclass, cd_type, cd_cache, cd_profile, cd_repl, cd_action, cd_audit from core_dio order by cd_namespace, cd_name, cd_sysclass, cd_version');

  my $self = {
    'sth' => $sth,
    'dbi' => $dbi,
  };
  bless $self;
  return $self;
}
sub done {
  my ($self) = @_;
  $self->{'dbi'}->db_done($self->{'sth'});
}
sub iter {
  my ($self) = @_;
  my $out_h;
  my @d = $self->{'dbi'}->db_fetch($self->{'sth'});
  if (@d) {
    @$out_h{ 'cd_audit','cd_id','cd_sysclass','cd_profile','cd_version','cd_action','cd_repl','cd_cache','cd_type','cd_name','cd_namespace' } = map {((defined $_)?$_:'')} @d[ 10,0,4,7,3,9,8,6,5,2,1];
    return $out_h;
  } else {
    $self->{'dbi'}->db_done($self->{'sth'});
    return;
  }
}

1;
